const { defineConfig } = require('@vue/cli-service')
const CopyWebpackPlugin = require('copy-webpack-plugin');

const path = require("path");
const name =  '智慧安防系统'

function resolve(dir) {
  return path.join(__dirname, dir)
}

module.exports = defineConfig(

    {
      transpileDependencies: [ // 转换非es6语法插件
        '@riophae/vue-treeselect'
      ],
      configureWebpack: {
        plugins: [
          new CopyWebpackPlugin([
            { from: 'node_modules/@liveqing/liveplayer/dist/component/crossdomain.xml'},
            { from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer-lib.min.js', to: 'js/'},
            { from: 'node_modules/@liveqing/liveplayer/dist/component/liveplayer.swf'}
          ])
        ]
      },
      publicPath: process.env.NODE_ENV === "production" ? "/" : "/",
      devServer:{
        port:80,
        open:true,
        client: {
          overlay: false
        },
        proxy: {
          [process.env.VUE_APP_BASE_API]: {
            target: `http://localhost:18080`,
            changeOrigin: true,
            pathRewrite: {
              ['^' + process.env.VUE_APP_BASE_API]: ''
            }
          }
        },
      },


    },

)
